package com.shxc.smarttrade.test;

import android.os.Bundle;


import com.shxc.smarttrade.base.BaseActivity;
import com.shxc.smarttrade.utils.Loger;

import org.xchris.http.ViseHttp;
import org.xchris.http.callback.ACallback;
import org.xchris.http.mode.DownProgress;

/**
 * Created by czq on 2017/11/28.
 */

public class DownLoadActivity extends BaseActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        downLoad();
    }

    private void downLoad() {

        ViseHttp.DOWNLOAD("weixin/android/weixin6330android920.apk")
                .baseUrl("http://dldir1.qq.com/")
                .setFileName("weixin6330android920.apk")
                .request(new ACallback<DownProgress>() {
                    @Override
                    public void onSuccess(DownProgress downProgress) {
                        Loger.e("1",downProgress.getDownloadSize());
                        Loger.e("2",downProgress.getFormatDownloadSize());
                        Loger.e("3",downProgress.getFormatStatusString());
                        Loger.e("4",downProgress.getFormatTotalSize());
                        Loger.e("5",downProgress.getPercent());
                        Loger.e("6",downProgress.getTotalSize());

                    }

                    @Override
                    public void onFail(int errCode, String errMsg) {
                    }
                });

    }
}
